﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace QuailDashboard.View.Controls
{
    public partial class ProcessingModalControl : UserControl
    {
        public ProcessingModalControl()
        {
            InitializeComponent();

            Loaded += ProcessingModalControl_Loaded;
        }

        void ProcessingModalControl_Loaded(object sender, RoutedEventArgs e)
        {
        }

        public Visibility ModalVisibility
        {
            get { return (Visibility)GetValue(ModalVisibilityProperty); }
            set { SetValue(ModalVisibilityProperty, value); }
        }

        public static readonly DependencyProperty ModalVisibilityProperty = DependencyProperty.Register("ModalVisibility", typeof(System.Windows.Visibility), typeof(ProcessingModalControl), new PropertyMetadata(ModalVisibilityChanged));

        private static void ModalVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Code for dealing with your property changes
            if (e.NewValue != null)
                ((ProcessingModalControl)d).OnModalVisibilityChanged((Visibility)e.NewValue);
        }
        private void OnModalVisibilityChanged(Visibility visibility)
        {
            if (visibility == Visibility.Visible)
            {
                //SetScreenPosition();
                LayoutRoot.Visibility = visibility;
            }
            else
            {
                LayoutRoot.Visibility = Visibility.Collapsed;
            }
        }

        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ProcessingModalControl), new PropertyMetadata("", TextChanged));

        private static void TextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Code for dealing with your property changes
            if (e.NewValue != null)
                ((ProcessingModalControl)d).OnTextChanged((string)e.NewValue);
        }

        private void OnTextChanged(string text)
        {
            txtText.Text = text;
        }

        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
        }
    }
}
